#include<bits/stdc++.h>
using namespace std;
int n,r[100005],a[100005],b[100005],ans;
vector<int> v;
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>r[i];
        a[r[i]]++;
        b[r[i]]++;
    }
    for(int i=1;i<=100001;i++)
    {
        if(a[i]) v.push_back(i);
        //if(a[i]) cout<<i<<" "<<a[i]<<'\n';
    }
    int m=v.size();
    m--;
    int ans=n,p=0,q=1;
    while(q<=m)
    {
        int a1=a[v[p]];
        int b1=b[v[q]];
        //cout<<p<<" "<<q<<'\n';
        if(b1>a1)
        {
            ans-=a1;
            b[v[q]]-=a1;
            a[v[p]]=0;
            p++;
            if(p==q) q=p+1;
        }
        else if(b1==a1)
        {
            ans-=a1;
            b[v[q]]-=a1;
            a[v[p]]=0;
            p++;
            q++;
        }
        else
        {
            ans-=b1;
            a[v[p]]-=b1;
            b[v[q]]=0;
            q++;
        }
        //cout<<ans<<" "<<a1<<" "<<b1<<" "<<p<<" "<<q<<'\n';
    }
    cout<<ans<<'\n';
    fclose(stdin);
    fclose(stdout);
    return 0;
}
